export default [
	{
		path: '/home',
		name:'Home',
		component: () => import('@/pages/Home/Home'),
		children:[
			{ 
				path: '/home/:categoryId', 
				component: () => import('@/pages/Home/NavItem/NavItem'),
				meta:{isShow:true}
			}
		],
		meta:{isShow:true}
	},
	{
		path: '/cart',
		name:'Cart',
		component: () => import('@/pages/Cart/Cart'),
		meta:{isShow:true}
	},
	{
		path: '/category:index?',
		name: 'Category',
		component: () => import('@/pages/Category/Category'),
		meta:{isShow:true}
	},
	{
		path: '/subcatelist',
		name: 'SubCateList',
		component: () => import('@/pages/Category/SubCateList/index.vue'),
	},
	{
		path: '/center',
		name:'Center',
		component: () => import('@/pages/Center/Center'),
		meta:{isShow:true}
	},
	{
		path: '/detail',
		name:'Detail',
		component: () => import('@/pages/Detail/Detail'),
	},
	{
		path: '/worthbuy',
		name:'WorthBuy',
		component: () => import('@/pages/WorthBuy/WorthBuy'),
		meta:{isShow:true}

	},
	{
		path: '/login',
		name:'Login',
		component: () => import('@/pages/Login/Login'),
	},
	{
		path: '/pay',
		name:'Pay',
		component: () => import('@/pages/Pay/Pay'),
		beforeEnter: (to, from, next) => {
			//只有从交易才能到支付页面
			if(from.path === '/trade'){
				next()
			}else{
				next('/home')
			}
		}
	},
	{
		path: '/search',
		name:'Search',
		component: () => import('@/pages/Search/Search'),
	},
	{
		path: '/register',
		name: 'Register',
		component: () => import('@/pages/Register/Register'),
	},
	{
		path: '/trade',
		name: 'Trade',
		component: () => import('@/pages/Pay/Trade'),
		beforeEnter: (to, from, next) => {
			//只有从购物车才能到交易
			if(from.path === '/cart'){
				next()
			}else{
				next('/home')
			}
		}
	},
	//访问根路径，跳转到主页
	{
		path: '/',
		redirect: '/home'
	},
	// 访问的路径都没有的话,回到首页
	{   path: '*',
		redirect: '/home'
	}


]
